Objective: assess racial-ethnic mix in adolescent suicides and contrast with overall suicides.

Other research questions: evolution of the racial-ethnic distribution of adolescent suicides over time (+ relative to the proportion of the population in that age group)

In parallel: evolution of the racial-ethnic distribution of overall suicides and adult suicides (20+) over time (+ relative to the proportion of the US population -- overall or 20+)

For now, we can focus on the national level.

However, we could also assess whether differences among racial-ethnic subgroups are more pronounced in certain HHS regions and/or states.

Along these lines, health journalists at CNN, US News, and NBC were most interested in the racial-ethnic mix in the 5 states with a stat. sig. increase in the absolute number of suicides + proportion outcome as well as California (stat. sig. increase in the proportion outcome only).

Data extraction :

CDC Wonder, Provisional Mortality Statistics, 2018 through Last Month Request & Current Final Multiple Cause of Death Data

Groupby: Residence HHS Regions, Gender, Year, Single Race 6, Hispanic Origin

Cause of death: Intentional self-harm

7 files:

  • All years "Overall" (age-adjusted)
  • 10-19 years "10-19"
  • 20-64 years "20-64"
  • 25-64 years "25-64" (age-adjusted)
  • 20+ years "20plus"
  • 25+ years "25plus" (age-adjusted)
  • 65+ years "65plus" (age-adjusted)

Years after 2010

In [ ]:
# Run this code to keep plotly figures when exporting the notebook in HTML
import plotly
plotly.offline.init_notebook_mode()
In [ ]:
from wonder_utils import SuicideData

sd = SuicideData()  # or? reject_list=["More than one race", "Not Stated"]

Analysis at the national level¶

Subpopulation: adolescents (10-19) – 12 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

Subpopulation: working-age adults (20-64) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: older adults (65+) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: all adults (20+) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: everyone, all age groups – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "age_strat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Analysis by HHS region¶

First type of visualizations: one subplot by HHS region¶

Subpopulation: adolescents (10-19) – 12 graphs, with 10 HHS-region subplots on each¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents adults (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents adults (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents adults (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents adults (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

Subpopulation: working-age adults (20-64) – 16 graphs, with 10 HHS-region subplots on each¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: older adults (65+) – 16 graphs, with 10 HHS-region subplots on each¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: all adults (20+) – 16 graphs, with 10 HHS-region subplots on each¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: everyone, all age groups – 16 graphs, with 10 HHS-region subplots on each¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "gender",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Gender"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethnicity",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "race",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "ethno_race_4_cat",
               "by": "hhs",
               "scatter": False,
               "rows": 2,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}},
               "by_list": [f"HHS{i}" for i in range(1, 11)]}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "Race-Ethnicity"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Second type of visualizations: all HHS regions on the same plot¶

Subpopulation: adolescents (10-19) – 12 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "gender",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethnicity",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "race",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethno_race_4_cat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "10-19"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among adolescents (10-19)"
kwargs["plot_filename"] = f"adolescents_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

Subpopulation: working-age adults (20-64) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "gender",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethnicity",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "race",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethno_race_4_cat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20-64"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20-64)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: older adults (65+) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "gender",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethnicity",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "race",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethno_race_4_cat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "65plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (65+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: all adults (20+) – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "gender",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethnicity",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "race",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethno_race_4_cat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "20plus"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (20+)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

Subpopulation: everyone, all age groups – 16 graphs¶

By gender¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "gender",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethnicity",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "race",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'

By race-ethnicity¶

In [ ]:
plot_params = {"x": "year",
               "color": "hhs",
               "by": "ethno_race_4_cat",
               "scatter": False,
               "rows": 1,
               "data_slice": {"age_strat": "Overall"},
               "second_y": {"secondary_y": True,
                            "y": "pop_share",
                            "line_param": {"dash": "dot"}}}
kwargs = {"secondary_range": [0, 100],
          "secondary_ticksuffix": "%",
          "hide_title": True,
          "second_y_title_text": "% of the population in this age group",
          "legend_text": "HHS Region"}

plot_params["y"] = "deaths"
kwargs["y_title_text"] = "Absolute count of suicides among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

plot_params["y"] = "suicide_proportion"
kwargs["y_title_text"] = "Proportion of suicides occurring among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
kwargs["primary_ticksuffix"] = "%"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
kwargs.pop("primary_ticksuffix")
plot_params.pop("primary_ticksuffix")

plot_params["y"] = "suicide_per_100k"
kwargs["y_title_text"] = "Crude suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )

"""
plot_params["y"] = "age_adjusted_rate"
kwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"
kwargs["plot_filename"] = f"working-age_{plot_params['color']}_{plot_params['y']}"
plot_params.update(kwargs)

sd.plot(**plot_params
    )
"""
Out[ ]:
'\nplot_params["y"] = "age_adjusted_rate"\nkwargs["y_title_text"] = "Age-adjusted suicide rate among working-age adults (all age groups)"\nkwargs["plot_filename"] = f"working-age_{plot_params[\'color\']}_{plot_params[\'y\']}"\nplot_params.update(kwargs)\n\nsd.plot(**plot_params\n    )\n'